issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==3] <- "CH - Radical Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==4] <- "CH - Social Democratic Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==5] <- "CH - Swiss Peoples Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==7] <- "CH - Liberal Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==8] <- "CH - Labour Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==9] <- "CH - Swiss Democrats"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==10] <- "CH - Green Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==11] <- "CH - Freedom Party"
issp_2007$voted_parties[issp_2007$country=="Switzerland" & issp_2007$CH_PRTY==95] <- "CH - Other party"
issp_2007$voted_parties <- ifelse(issp_2007$country=="Switzerland" & is.na(issp_2007$voted_parties), "CH - Missing", issp_2007$voted_parties)
table(issp_2007$FI_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==1] <- "FI - Social Democr Party"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==2] <- "FI - Centre Party of FIN"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==3] <- "FI - Nat Coalition Party"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==4] <- "FI - Left Alliance"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==5] <- "FI - Swedish Peoples Prty"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==6] <- "FI - Green League"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==7] <- "FI - Christian League"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==8] <- "FI - True Finns"
issp_2007$voted_parties[issp_2007$country=="Finland" & issp_2007$FI_PRTY==95] <- "FI - Other Party"
issp_2007$voted_parties <- ifelse(issp_2007$country=="Finland" & is.na(issp_2007$voted_parties), "FI - Missing", issp_2007$voted_parties)
table(issp_2007$IE_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==1] <- "IE - Fianna Fail"
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==2] <- "IE - Fine Gael"
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==3] <- "IE - Labour"
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==4] <- "IE - Progressive Democrats"
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==5] <- "IE - Green Party"
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==7] <- "IE - Sinn Fein"
issp_2007$voted_parties[issp_2007$country=="Ireland" & issp_2007$IE_PRTY==95] <- "IE - Other party"
issp_2007$voted_parties <- ifelse(issp_2007$country=="Ireland" & is.na(issp_2007$voted_parties), "IE - Missing", issp_2007$voted_parties)
table(issp_2007$KR_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="South Korea" & issp_2007$KR_PRTY==1] <- "KR - People First Party"
issp_2007$voted_parties[issp_2007$country=="South Korea" & issp_2007$KR_PRTY==2] <- "KR - Democratic Labor Party"
issp_2007$voted_parties[issp_2007$country=="South Korea" & issp_2007$KR_PRTY==3] <- "KR - Uri Party"
issp_2007$voted_parties[issp_2007$country=="South Korea" & issp_2007$KR_PRTY==4] <- "KR - Democratic Party"
issp_2007$voted_parties[issp_2007$country=="South Korea" & issp_2007$KR_PRTY==5] <- "KR - Grand National Party"
issp_2007$voted_parties[issp_2007$country=="South Korea" & issp_2007$KR_PRTY==95] <- "KR - Other party"
issp_2007$voted_parties <- ifelse(issp_2007$country=="South Korea" & is.na(issp_2007$voted_parties), "KR - Missing", issp_2007$voted_parties)
table(issp_2007$MX_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==1] <- "MX - pan"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==2] <- "MX - pri"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==3] <- "MX - prd"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==4] <- "MX - pt"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==5] <- "MX - pvem"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==6] <- "MX - Convergencia"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==8] <- "MX - panal"
issp_2007$voted_parties[issp_2007$country=="Mexico" & issp_2007$MX_PRTY==95] <- "MX - Other party"
issp_2007$voted_parties <- ifelse(issp_2007$country=="Mexico" & is.na(issp_2007$voted_parties), "MX - Missing", issp_2007$voted_parties)
table(issp_2007$NZ_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==1] <- "NZ - Act"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==2] <- "NZ - Alliance"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==3] <- "NZ - Green"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==4] <- "NZ - Labour"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==5] <- "NZ - National"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==6] <- "NZ - NZ First"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==7] <- "NZ - Progressive Coalition"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==8] <- "NZ - United Future"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==9] <- "NZ - Maori Party"
issp_2007$voted_parties[issp_2007$country=="New Zealand" & issp_2007$NZ_PRTY==95] <- "NZ - Other party"
issp_2007$voted_parties <- ifelse(issp_2007$country=="New Zealand" & is.na(issp_2007$voted_parties), "NZ - Missing", issp_2007$voted_parties)
table(issp_2007$PH_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==1] <- "PH - nationalista"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==3] <- "PH - OPOSISYON/OPPOSITION"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==4] <- "PH - LIBERAL PARTY"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==5] <- "PH - kampi"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==6] <- "PH - independent"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==8] <- "PH - PARTIDO NINA TRILLANES AT ESCUDERO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==9] <- "PH - TEAM UNITY"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==10] <- "PH - administration"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==13] <- "PH - PARTIDO NI ERAP"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==14] <- "PH - akbayan"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==15] <- "PH - FPJ PM - FERNANDO POE JR. - PARTIDONG MASA"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==19] <- "PH - LAKAS-NUCD-CMD"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==24] <- "PH - buhay"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==28] <- "PH - cibac"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==29] <- "PH - MASANG PILIPINO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==30] <- "PH - anakbayan"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==31] <- "PH - BAYAN MUNA"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==33] <- "PH - laban"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==36] <- "PH - lakas"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==38] <- "PH - lacson"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==39] <- "PH - BOPK - BANDO OSME�A PUNDOK KAUSWAGAN"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==41] <- "PH - kababaihan"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==46] <- "PH - PARTIDO NI MAYOR CONSTANTINO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==47] <- "PH - rightess"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==48] <- "PH - neutral"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==49] <- "PH - ANAK PAWIS"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==50] <- "PH - NPC-NATIONAL PEOPLE COALITION"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==51] <- "PH - OMPIA PARTY"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==52] <- "PH - UMMAH PARTY"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==53] <- "PH - PARTIDO NI CORY AQUINO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==54] <- "PH - LABAN SA PARTIDO NI GLORIA"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==55] <- "PH - LABAN NG DEMOKRATIKONG PILIPINO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==56] <- "PH - PARTIDO NI JUN LOZADA"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==57] <- "PH - PARTIDO NI SILVERIO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==58] <- "PH - amante"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==59] <- "PH - poverty"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==60] <- "PH - PARTIDO NI GOV.MIGS DOMINGUEZ (SARANGGANI)"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==61] <- "PH - PARTIDO NI MAYOR AGUILA"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==62] <- "PH - DUTERTE PARA SA MASA"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==63] <- "PH - SAMAHANG WARAY"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==64] <- "PH - KILUSAN NG MASANG PILIPINO"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==65] <- "PH - CHRISTIAN MUSLIM DEMOCRATIC FEDERATION"
issp_2007$voted_parties[issp_2007$country=="the Philippines" & issp_2007$PH_PRTY==66] <- "PH - THE TEACHER"
issp_2007$voted_parties <- ifelse(issp_2007$country=="the Philippines" & is.na(issp_2007$voted_parties), "PH - Missing", issp_2007$voted_parties)
table(issp_2007$RU_PRTY, exclude = NULL)
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==1] <- "RU - Pensioners Party/Party of Social Justice"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==2] <- "RU - Union of right forces"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==3] <- "RU - Yabloko"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==4] <- "RU - Russian Ecological Party �Green� (Panfilov A.)"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==5] <- "RU - Country Party of Russia (Lapshin M.)"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==7] <- "RU - Party of Revival/Russian Party of Life (Seleznev G./ Miro"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==8] <- "RU - Motherland (Glazyev S.)"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==9] <- "RU - Liberal Democratic Party of Russia (Ghirinovsky V.)"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==10] <- "RU - United Russia (Gryzlov B.)"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==11] <- "RU - Communist Party of Russian Federation (Zyuganov G.)"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==95] <- "RU - Other party"
issp_2007$voted_parties[issp_2007$country=="Russia" & issp_2007$RU_PRTY==96] <- "RU - Against all/ threw out/ damaged voting paper"
issp_2007$voted_parties <- ifelse(issp_2007$country=="Russia" & is.na(issp_2007$voted_parties), "RU - Missing", issp_2007$voted_parties)
table(issp_2007$voted_parties, exclude = NULL)
table(issp_2007$religious_denomination, exclude = NULL)
issp_2007$religious_denomination <- ifelse(is.na(issp_2007$religious_denomination), "Missing", issp_2007$religious_denomination)
table(issp_2007$latitude, exclude = NULL)
issp_2007$latitude <- ifelse(is.na(issp_2007$latitude), -999999, issp_2007$latitude)
table(issp_2007$longitude, exclude = NULL)
issp_2007$longitude <- ifelse(is.na(issp_2007$longitude), -999999, issp_2007$longitude)
table(issp_2007$mean_temperature, exclude = NULL)
issp_2007$mean_temperature <- ifelse(is.na(issp_2007$mean_temperature), -999999, issp_2007$mean_temperature)
table(issp_2007$mid_field_season, exclude = NULL)
issp_2007$mid_field_season <- ifelse(is.na(issp_2007$mid_field_season), "Missing", issp_2007$mid_field_season)
issp_2007$latitude <- ifelse(issp_2007$latitude == -999999, NA, issp_2007$latitude)
issp_2007$longitude <- ifelse(issp_2007$longitude == -999999, NA, issp_2007$longitude)
issp_2007$mean_temperature <- ifelse(issp_2007$mean_temperature == -999999, NA, issp_2007$mean_temperature)
issp_2007$mid_field_season <- ifelse(issp_2007$mid_field_season == "Missing", NA, issp_2007$mid_field_season)
issp_2007 <- fastDummies::dummy_cols(issp_2007, select_columns = 'religious_denomination')
issp_2007$PARTY_LR_avg <- mean(issp_2007$PARTY_LR, na.rm = T)
issp_2007$PARTY_LR_sd <- sd(issp_2007$PARTY_LR, na.rm = T)
issp_2007$PARTY_LR_2sd <- issp_2007$PARTY_LR_sd*2
issp_2007$PARTY_LR_beta <- (issp_2007$PARTY_LR-issp_2007$PARTY_LR_avg)/issp_2007$PARTY_LR_2sd
table(issp_2007$PARTY_LR_beta, exclude = NULL)
issp_2007$religiosity_avg <- mean(issp_2007$religiosity, na.rm = T)
issp_2007$religiosity_sd <- sd(issp_2007$religiosity, na.rm = T)
issp_2007$religiosity_2sd <- issp_2007$religiosity_sd*2
issp_2007$religiosity_beta <- (issp_2007$religiosity-issp_2007$religiosity_avg)/issp_2007$religiosity_2sd
table(issp_2007$religiosity_beta, exclude = NULL)
issp_2007 <- issp_2007 %>%
group_by(country) %>%
mutate(group_mean_chronotype = mean(chronotype_interval, na.rm = T),
group_sd_chronotype = sd(chronotype_interval, na.rm = T))
issp_2007$chronotype_interval_avg <- issp_2007$group_mean_chronotype
issp_2007$chronotype_interval_sd <- issp_2007$group_sd_chronotype
issp_2007$chronotype_interval_2sd <- issp_2007$chronotype_interval_sd*2
issp_2007$chronotype_interval_beta <- (issp_2007$chronotype_interval-issp_2007$chronotype_interval_avg)/issp_2007$chronotype_interval_2sd
issp_2007$day_off_avg <- mean(issp_2007$day_off, na.rm = T)
issp_2007$day_off_beta <- (issp_2007$day_off-issp_2007$day_off_avg)
table(issp_2007$urban_rural_area, exclude = NULL)
issp_2007$urban_rural_area_avg <- mean(issp_2007$urban_rural_area, na.rm = T)
issp_2007$urban_rural_area_sd <- sd(issp_2007$urban_rural_area, na.rm = T)
issp_2007$urban_rural_area_2sd <- issp_2007$urban_rural_area_sd*2
issp_2007$urban_rural_area_beta <- (issp_2007$urban_rural_area-issp_2007$urban_rural_area_avg)/issp_2007$urban_rural_area_2sd
table(issp_2007$age, exclude = NULL)
issp_2007$age_avg <- mean(issp_2007$age, na.rm = T)
issp_2007$age_sd <- sd(issp_2007$age, na.rm = T)
issp_2007$age_2sd <- issp_2007$age_sd*2
issp_2007$age_beta <- (issp_2007$age-issp_2007$age_avg)/issp_2007$age_2sd
table(issp_2007$degree, exclude = NULL)
issp_2007$degree_avg <- mean(issp_2007$degree, na.rm = T)
issp_2007$degree_sd <- sd(issp_2007$degree, na.rm = T)
issp_2007$degree_2sd <- issp_2007$degree_sd*2
issp_2007$degree_beta <- (issp_2007$degree-issp_2007$degree_avg)/issp_2007$degree_2sd
issp_2007$sex_dummy_avg <- mean(issp_2007$sex, na.rm = T)
issp_2007$sex_beta <- (issp_2007$sex-issp_2007$sex_dummy_avg)
issp_2007$political_interest_avg <- mean(issp_2007$political_interest, na.rm = T)
issp_2007$political_interest_sd <- sd(issp_2007$political_interest, na.rm = T)
issp_2007$political_interest_2sd <- issp_2007$political_interest_sd*2
issp_2007$political_interest_beta <- (issp_2007$political_interest-issp_2007$political_interest_avg)/issp_2007$political_interest_2sd
issp_2007$income_avg <- mean(issp_2007$income, na.rm = T)
issp_2007$income_sd <- sd(issp_2007$income, na.rm = T)
issp_2007$income_2sd <- issp_2007$income_sd*2
issp_2007$income_beta <- (issp_2007$income-issp_2007$income_avg)/issp_2007$income_2sd
table(issp_2007$religious_denomination_Buddhism, exclude = NULL)
issp_2007$religious_denomination_Buddhism_avg <- mean(issp_2007$religious_denomination_Buddhism, na.rm = T)
issp_2007$religious_denomination_Buddhism_beta <- (issp_2007$religious_denomination_Buddhism-issp_2007$religious_denomination_Buddhism_avg)
table(issp_2007$religious_denomination_Buddhism_beta, exclude = NULL)
table(issp_2007$religious_denomination_Christian_Orthodox, exclude = NULL)
issp_2007$religious_denomination_Christian_Orthodox_avg <- mean(issp_2007$religious_denomination_Christian_Orthodox, na.rm = T)
issp_2007$religious_denomination_Christian_Orthodox_beta <- (issp_2007$religious_denomination_Christian_Orthodox-issp_2007$religious_denomination_Christian_Orthodox_avg)
table(issp_2007$religious_denomination_Christian_Orthodox_beta, exclude = NULL)
table(issp_2007$religious_denomination_Hinduism, exclude = NULL)
issp_2007$religious_denomination_Hinduism_avg <- mean(issp_2007$religious_denomination_Hinduism, na.rm = T)
issp_2007$religious_denomination_Hinduism_beta <- (issp_2007$religious_denomination_Hinduism-issp_2007$religious_denomination_Hinduism_avg)
table(issp_2007$religious_denomination_Hinduism_beta, exclude = NULL)
table(issp_2007$religious_denomination_Islam, exclude = NULL)
issp_2007$religious_denomination_Islam_avg <- mean(issp_2007$religious_denomination_Islam, na.rm = T)
issp_2007$religious_denomination_Islam_beta <- (issp_2007$religious_denomination_Islam-issp_2007$religious_denomination_Islam_avg)
table(issp_2007$religious_denomination_Islam_beta, exclude = NULL)
table(issp_2007$religious_denomination_Jewish, exclude = NULL)
issp_2007$religious_denomination_Jewish_avg <- mean(issp_2007$religious_denomination_Jewish, na.rm = T)
issp_2007$religious_denomination_Jewish_beta <- (issp_2007$religious_denomination_Jewish-issp_2007$religious_denomination_Jewish_avg)
table(issp_2007$religious_denomination_Jewish_beta, exclude = NULL)
table(issp_2007$religious_denomination_No_religion, exclude = NULL)
issp_2007$religious_denomination_No_religion_avg <- mean(issp_2007$religious_denomination_No_religion, na.rm = T)
issp_2007$religious_denomination_No_religion_beta <- (issp_2007$religious_denomination_No_religion-issp_2007$religious_denomination_No_religion_avg)
table(issp_2007$religious_denomination_No_religion_beta, exclude = NULL)
table(issp_2007$religious_denomination_Other_Christian_Religions, exclude = NULL)
issp_2007$religious_denomination_Other_Christian_Religions_avg <- mean(issp_2007$religious_denomination_Other_Christian_Religions, na.rm = T)
issp_2007$religious_denomination_Other_Christian_Religions_beta <- (issp_2007$religious_denomination_Other_Christian_Religions-issp_2007$religious_denomination_Other_Christian_Religions_avg)
table(issp_2007$religious_denomination_Other_Christian_Religions_beta, exclude = NULL)
table(issp_2007$religious_denomination_Other_Eastern_Religions, exclude = NULL)
issp_2007$religious_denomination_Other_Eastern_Religions_avg <- mean(issp_2007$religious_denomination_Other_Eastern_Religions, na.rm = T)
issp_2007$religious_denomination_Other_Eastern_Religions_beta <- (issp_2007$religious_denomination_Other_Eastern_Religions-issp_2007$religious_denomination_Other_Eastern_Religions_avg)
table(issp_2007$religious_denomination_Other_Eastern_Religions_beta, exclude = NULL)
table(issp_2007$religious_denomination_Other_Religions, exclude = NULL)
issp_2007$religious_denomination_Other_Religions_avg <- mean(issp_2007$religious_denomination_Other_Religions, na.rm = T)
issp_2007$religious_denomination_Other_Religions_beta <- (issp_2007$religious_denomination_Other_Religions-issp_2007$religious_denomination_Other_Religions_avg)
table(issp_2007$religious_denomination_Other_Religions_beta, exclude = NULL)
table(issp_2007$religious_denomination_Protestant, exclude = NULL)
issp_2007$religious_denomination_Protestant_avg <- mean(issp_2007$religious_denomination_Protestant, na.rm = T)
issp_2007$religious_denomination_Protestant_beta <- (issp_2007$religious_denomination_Protestant-issp_2007$religious_denomination_Protestant_avg)
table(issp_2007$religious_denomination_Protestant_beta, exclude = NULL)
table(issp_2007$religious_denomination_Roman_Catholic, exclude = NULL)
issp_2007$religious_denomination_Roman_Catholic_avg <- mean(issp_2007$religious_denomination_Roman_Catholic, na.rm = T)
issp_2007$religious_denomination_Roman_Catholic_beta <- (issp_2007$religious_denomination_Roman_Catholic-issp_2007$religious_denomination_Roman_Catholic_avg)
table(issp_2007$religious_denomination_Roman_Catholic_beta, exclude = NULL)
issp_2007_left_right_model1 <- lmer(PARTY_LR_beta ~ chronotype_interval_beta + (1 + chronotype_interval_beta | country),
data =  issp_2007)
issp_2007_left_right_model2 <- lmer(PARTY_LR_beta ~ chronotype_interval_beta + urban_rural_area_beta + (1 + chronotype_interval_beta | country),
data =  issp_2007)
issp_2007_left_right_model3 <- lmer(PARTY_LR_beta ~ chronotype_interval_beta + urban_rural_area_beta +
sex_beta + age_beta + degree_beta + income_beta + religiosity_beta + political_interest_beta + (1 + chronotype_interval_beta | country),
data =  issp_2007)
issp_2007_religiosity_model1 <- lmer(religiosity_beta ~ chronotype_interval_beta + (1 + chronotype_interval_beta | country),
data =  issp_2007)
issp_2007_religiosity_model2 <- lmer(religiosity_beta ~ chronotype_interval_beta + urban_rural_area_beta + (1 + chronotype_interval_beta  | country),
data =  issp_2007)
issp_2007_religiosity_model3 <- lmer(religiosity_beta ~ chronotype_interval_beta + urban_rural_area_beta +
sex_beta + age_beta + degree_beta + income_beta + political_interest_beta + (1  + chronotype_interval_beta | country),
data =  issp_2007)
issp_2007_religiosity_model4 <- lmer(religiosity_beta ~ chronotype_interval_beta + urban_rural_area_beta +
sex_beta + age_beta + degree_beta + income_beta + political_interest_beta + PARTY_LR_beta + (1  + chronotype_interval_beta | country),
data =  issp_2007)
table(issp_2007$chronotype_interval_beta, exclude = NULL)
chr_values <- unique(issp_2007$chronotype_interval_beta)
chr_values <- data.frame(chr_values)
chr_values$chr_values <- sort(chr_values$chr_values)
library(marginaleffects)
predicted_values_ideology <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = NA,
chronotype_interval_beta = c(chr_values$chr_values)), include_random = FALSE)
predicted_values_ideology <- subset(predicted_values_ideology, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology$Effect <- "Fixed Effect"
predicted_values_ideology$Sample <- "Pooled"
predicted_values_ideology$Significance <- "Insignificant"
predicted_values_ideology$Size <- 1
predicted_values_ideology_FI <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "Finland",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_FI <- subset(predicted_values_ideology_FI, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_FI$Effect <- "Predicted Effect"
predicted_values_ideology_FI$Sample <- "Finland"
predicted_values_ideology_FI$Significance <- "Insignificant"
predicted_values_ideology_FI$Size <- 0.25
predicted_values_ideology_GR <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "Greece",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_GR <- subset(predicted_values_ideology_GR, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_GR$Effect <- "Predicted Effect"
predicted_values_ideology_GR$Sample <- "Greece"
predicted_values_ideology_GR$Significance <- "Marginally Significant"
predicted_values_ideology_GR$Size <- 0.5
predicted_values_ideology_IE <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "Ireland",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_IE <- subset(predicted_values_ideology_IE, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_IE$Effect <- "Predicted Effect"
predicted_values_ideology_IE$Sample <- "Ireland"
predicted_values_ideology_IE$Significance <- "Insignificant"
predicted_values_ideology_IE$Size <- 0.25
predicted_values_ideology_MX <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "Mexico",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_MX <- subset(predicted_values_ideology_MX, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_MX$Effect <- "Predicted Effect"
predicted_values_ideology_MX$Sample <- "Mexico"
predicted_values_ideology_MX$Significance <- "Insignificant"
predicted_values_ideology_MX$Size <- 0.25
predicted_values_ideology_NL <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "the Netherlands",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_NL <- subset(predicted_values_ideology_NL, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_NL$Effect <- "Predicted Effect"
predicted_values_ideology_NL$Sample <- "the Netherlands"
predicted_values_ideology_NL$Significance <- "Insignificant"
predicted_values_ideology_NL$Size <- 0.25
predicted_values_ideology_NZ <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "New Zealand",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_NZ <- subset(predicted_values_ideology_NZ, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_NZ$Effect <- "Predicted Effect"
predicted_values_ideology_NZ$Sample <- "New Zealand"
predicted_values_ideology_NZ$Significance <- "Marginally Significant"
predicted_values_ideology_NZ$Size <- 0.5
predicted_values_ideology_PH <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "the Philippines",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_PH <- subset(predicted_values_ideology_PH, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_PH$Effect <- "Predicted Effect"
predicted_values_ideology_PH$Sample <- "the Philippines"
predicted_values_ideology_PH$Significance <- "Insignificant"
predicted_values_ideology_PH$Size <- 0.25
predicted_values_ideology_RU <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "Russia",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_RU <- subset(predicted_values_ideology_RU, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_RU$Effect <- "Predicted Effect"
predicted_values_ideology_RU$Sample <- "Russia"
predicted_values_ideology_RU$Significance <- "Significant"
predicted_values_ideology_RU$Size <- 0.5
predicted_values_ideology_SK <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "South Korea",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_SK <- subset(predicted_values_ideology_SK, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_SK$Effect <- "Predicted Effect"
predicted_values_ideology_SK$Sample <- "South Korea"
predicted_values_ideology_SK$Significance <- "Insignificant"
predicted_values_ideology_SK$Size <- 0.25
predicted_values_ideology_CH <- predictions(issp_2007_left_right_model3,
newdata = datagrid(country = "Switzerland",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_ideology_CH <- subset(predicted_values_ideology_CH, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_ideology_CH$Effect <- "Predicted Effect"
predicted_values_ideology_CH$Sample <- "Switzerland"
predicted_values_ideology_CH$Significance <- "Significant"
predicted_values_ideology_CH$Size <- 0.5
predicted_values_ideology_PLOT_DATA <- dplyr::bind_rows(predicted_values_ideology,
predicted_values_ideology_FI,
predicted_values_ideology_GR,
predicted_values_ideology_IE,
predicted_values_ideology_MX,
predicted_values_ideology_NL,
predicted_values_ideology_NZ,
predicted_values_ideology_PH,
predicted_values_ideology_RU,
predicted_values_ideology_SK,
predicted_values_ideology_CH)
str(predicted_values_ideology_PLOT_DATA$Size)
predicted_values_ideology_PLOT_DATA$Size <- factor(predicted_values_ideology_PLOT_DATA$Size)
ideology_PLOT <- ggplot(data = predicted_values_ideology_PLOT_DATA, aes(x=chronotype_interval_beta, y=predicted, size = Size)) +
geom_line(aes(linetype=Sample)) +
scale_linetype_manual(values=c("dotted", # FI
"longdash", # GR
"dotted", # IR
"dotted", # MX
"longdash", # NZ
"solid", # POOLED
"solid", # RU
"dotted", # SK
"solid", # CH
"dotted", # NL
"dotted")) + theme_classic() +
scale_size_manual(values=c(0.35, 0.5, 2)) +
theme(legend.position="none") +
theme(axis.text.x=element_text(colour="black", size = 12), axis.text.y=element_text(colour="black", size = 12)) +
theme(axis.title=element_text(size=14, colour="black", face="bold"), legend.text=element_text(size=14), legend.title=element_text(size=14)) +
labs(    x = "\n Chronotype (Standardized) \n (Eveningness ← → Morningness)\n",
y = "\n Predicted Values of Left-Right Ideological Placement (Standardized) \n (Left ← → Right) \n",
title = "") +
scale_y_continuous(breaks=c(-0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8), limits = c(-0.6, 0.8))
ideology_PLOT
table(issp_2007$chronotype_interval_beta, exclude = NULL)
chr_values <- unique(issp_2007$chronotype_interval_beta)
chr_values <- data.frame(chr_values)
chr_values$chr_values <- sort(chr_values$chr_values)
library(marginaleffects)
predicted_values_religiosity <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = NA,
chronotype_interval_beta = c(chr_values$chr_values)), include_random = FALSE)
predicted_values_religiosity <- subset(predicted_values_religiosity, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity$Effect <- "Fixed Effect"
predicted_values_religiosity$Sample <- "Pooled"
predicted_values_religiosity$Significance <- "Significant"
predicted_values_religiosity$Size <- 1
predicted_values_religiosity_FI <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "Finland",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_FI <- subset(predicted_values_religiosity_FI, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_FI$Effect <- "Predicted Effect"
predicted_values_religiosity_FI$Sample <- "Finland"
predicted_values_religiosity_FI$Significance <- "Insignificant"
predicted_values_religiosity_FI$Size <- 0.25
predicted_values_religiosity_GR <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "Greece",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_GR <- subset(predicted_values_religiosity_GR, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_GR$Effect <- "Predicted Effect"
predicted_values_religiosity_GR$Sample <- "Greece"
predicted_values_religiosity_GR$Significance <- "Significant"
predicted_values_religiosity_GR$Size <- 0.5
predicted_values_religiosity_IE <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "Ireland",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_IE <- subset(predicted_values_religiosity_IE, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_IE$Effect <- "Predicted Effect"
predicted_values_religiosity_IE$Sample <- "Ireland"
predicted_values_religiosity_IE$Significance <- "Significant"
predicted_values_religiosity_IE$Size <- 0.5
predicted_values_religiosity_MX <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "Mexico",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_MX <- subset(predicted_values_religiosity_MX, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_MX$Effect <- "Predicted Effect"
predicted_values_religiosity_MX$Sample <- "Mexico"
predicted_values_religiosity_MX$Significance <- "Significant"
predicted_values_religiosity_MX$Size <- 0.5
predicted_values_religiosity_NL <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "the Netherlands",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_NL <- subset(predicted_values_religiosity_NL, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_NL$Effect <- "Predicted Effect"
predicted_values_religiosity_NL$Sample <- "the Netherlands"
predicted_values_religiosity_NL$Significance <- "Significant"
predicted_values_religiosity_NL$Size <- 0.5
predicted_values_religiosity_NZ <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "New Zealand",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_NZ <- subset(predicted_values_religiosity_NZ, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_NZ$Effect <- "Predicted Effect"
predicted_values_religiosity_NZ$Sample <- "New Zealand"
predicted_values_religiosity_NZ$Significance <- "Insignificant"
predicted_values_religiosity_NZ$Size <- 0.25
predicted_values_religiosity_PH <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "the Philippines",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_PH <- subset(predicted_values_religiosity_PH, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_PH$Effect <- "Predicted Effect"
predicted_values_religiosity_PH$Sample <- "the Philippines"
predicted_values_religiosity_PH$Significance <- "Significant"
predicted_values_religiosity_PH$Size <- 0.5
predicted_values_religiosity_RU <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "Russia",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_RU <- subset(predicted_values_religiosity_RU, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_RU$Effect <- "Predicted Effect"
predicted_values_religiosity_RU$Sample <- "Russia"
predicted_values_religiosity_RU$Significance <- "Insignificant"
predicted_values_religiosity_RU$Size <- 0.25
predicted_values_religiosity_SK <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "South Korea",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_SK <- subset(predicted_values_religiosity_SK, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_SK$Effect <- "Predicted Effect"
predicted_values_religiosity_SK$Sample <- "South Korea"
predicted_values_religiosity_SK$Significance <- "Significant"
predicted_values_religiosity_SK$Size <- 0.5
predicted_values_religiosity_CH <- predictions(issp_2007_religiosity_model4,
newdata = datagrid(country = "Switzerland",
chronotype_interval_beta = c(chr_values$chr_values)))
predicted_values_religiosity_CH <- subset(predicted_values_religiosity_CH, select = c("predicted", "std.error", "chronotype_interval_beta"))
predicted_values_religiosity_CH$Effect <- "Predicted Effect"
predicted_values_religiosity_CH$Sample <- "Switzerland"
predicted_values_religiosity_CH$Significance <- "Insignificant"
predicted_values_religiosity_CH$Size <- 0.25
predicted_values_religiosity_PLOT_DATA <- dplyr::bind_rows(predicted_values_religiosity,
predicted_values_religiosity_FI,
predicted_values_religiosity_GR,
predicted_values_religiosity_IE,
predicted_values_religiosity_MX,
predicted_values_religiosity_NL,
predicted_values_religiosity_NZ,
predicted_values_religiosity_PH,
predicted_values_religiosity_RU,
predicted_values_religiosity_SK,
predicted_values_religiosity_CH)
str(predicted_values_religiosity_PLOT_DATA$Size)
predicted_values_religiosity_PLOT_DATA$Size <- factor(predicted_values_religiosity_PLOT_DATA$Size)
religiosity_PLOT <- ggplot(data = predicted_values_religiosity_PLOT_DATA, aes(x=chronotype_interval_beta, y=predicted, size = Size)) +
geom_line(aes(linetype=Sample)) +
scale_linetype_manual(values=c("dotted", # FI
"solid", # GR
"solid", # IR
"solid", # MX
"dotted", # NZ
"solid", # POOLED
"dotted", # RU
"solid", # SK
"dotted", # CH
"solid", # NL
"solid")) + theme_classic() +
scale_size_manual(values=c(0.35, 0.5, 2)) +
theme(axis.text.x=element_text(colour="black", size = 12), axis.text.y=element_text(colour="black", size = 12)) +
theme(axis.title=element_text(size=14, colour="black", face="bold"), legend.text=element_text(size=14), legend.title=element_text(size=14)) +
labs(    x = "\n Chronotype (Standardized) \n (Eveningness ← → Morningness)\n",
y = "\n Predicted Values of Religious Attendance (Standardized) \n (Lesser Religiosity ← → Higher Religiosity)\n",
title = "") +
theme(legend.position="none") +
scale_y_continuous(breaks=c(-0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8), limits = c(-0.6, 0.8))
religiosity_PLOT
predicted_figures <- ggpubr::ggarrange(ideology_PLOT, religiosity_PLOT,
ncol=2)
predicted_figures
ggsave(filename = "predicted_figures_300dpi.tiff", plot = predicted_figures, width = 20, height = 10, , dpi=300, compression = 'lzw')
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, width = 20, height = 10, , dpi=300, compression = 'lzw')
ggsave(filename = "predicted_figures_300dpi.tiff", plot = predicted_figures, width = 20, height = 10, dpi=300, compression = 'lzw')
ggsave(filename = "predicted_figures_300dpi.tiff", plot = predicted_figures, width = 20, height = 10, dpi=300, compression = 'lzw')
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, width = 20, height = 10, dpi=300, compression = 'lzw')
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, width = 20, height = 10, res=300)
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, width = 20, height = 10, res=300)
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, res=300)
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, width = 20, height = 10, res=300)
ggsave(filename = "predicted_figures_300dpi.png", plot = predicted_figures, width = 20, height = 10, dpi = 700)
ggsave(filename = "predicted_figures_300dpi.jpeg", plot = predicted_figures, width = 20, height = 10, dpi = 700)
ggsave(filename = "predicted_figures_300dpi.jpg", plot = predicted_figures, width = 20, height = 10, dpi = 700)
